package cn.haohaowo.spring.chapter4;

import junit.framework.Assert;

import org.junit.Test;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.core.io.ClassPathResource;

public class ResourceInjectTest {

	@Test
	public void testResourceInject() {
		ApplicationContext ctx = new ClassPathXmlApplicationContext("chapter-app.xml");
		ResourceBean3 resourceBean1 = ctx.getBean("resourceBean1", ResourceBean3.class);
		ResourceBean3 resourceBean2 = ctx.getBean("resourceBean2", ResourceBean3.class);
		Assert.assertTrue(resourceBean1.getResource() instanceof ClassPathResource);
		Assert.assertTrue(resourceBean2.getResource() instanceof ClassPathResource);
	}
}
